<template>
<h1>消息提示组件</h1>
  <el-button @click="f(1)">成功的消息提示</el-button>
  <el-button @click="f(2)">警告的消息提示</el-button>
  <el-button @click="f(3)">普通的消息提示</el-button>
  <el-button @click="f(4)">错误的消息提示</el-button>
</template>

<script setup>
import { ElMessage } from 'element-plus'

const f = (type) => {
  switch (type) {
    case 1:
      ElMessage.success('恭喜你，这是一条成功消息');
      break;
    case 2:
      ElMessage.warning('警告哦，这是一条警告消息');
      break;
    case 3:
      ElMessage.info('你好，这是一条消息提示');
      break;
    case 4:
      ElMessage.error({message:'错了哦，这是一条错误消息',showClose:true});
      break;
  }
}

</script>

<style scoped>

</style>